]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
status/network: Remove status from VPN item
authorFlorian Müllner <fmuellner@gnome.org>
Tue, 2 Aug 2022 09:33:37 +0000 (11:33 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Sun, 7 Aug 2022 20:41:09 +0000 (22:41 +0200)
It's odd to swap out a switch with a status label, and the
information isn't that helpful to begin with: It's either
transient (connecting, deactivating, ...), or too little to
be meaningful (unknown, failed, ...).

We're also perfectly happy to not show it in "label mode"
(i.e. when there's just one VPN).

Just get rid of it.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2406>

js/ui/status/network.js

index ff9c29650f607e2f8de4def7044591dc98b5c060..547dadc361a7c8627b8850d5f68c3a9df2529184 100644 (file)
@@ -1406,30 +1406,9 @@ var NMWireguardItem = class extends NMConnectionItem {
         let isActive = this.isActive();
         this.labelItem.label.text = isActive ? _('Turn Off') : this._section.getConnectLabel();
         this.radioItem.setToggleState(isActive);
-        this.radioItem.setStatus(this._getStatus());
         this.emit('icon-changed');
     }
 
-    _getStatus() {
-        if (this._activeConnection === null)
-            return null;
-
-        switch (this._activeConnection.state) {
-        case NM.ActiveConnectionState.UNKNOWN:
-            return _('unknown');
-        case NM.ActiveConnectionState.ACTIVATING:
-            return _('activating…');
-        case NM.ActiveConnectionState.ACTIVATED:
-            return null;
-        case NM.ActiveConnectionState.DEACTIVATING:
-            return _('deactivating…');
-        case NM.ActiveConnectionState.DEACTIVATED:
-            return _('deactivated');
-        default:
-            return 'invalid';
-        }
-    }
-
     _connectionStateChanged() {
         const state = this._activeConnection?.get_state();
         const reason = this._activeConnection?.get_state_reason();
@@ -1477,32 +1456,9 @@ var NMVpnConnectionItem = class extends NMConnectionItem {
         let isActive = this.isActive();
         this.labelItem.label.text = isActive ? _("Turn Off") : this._section.getConnectLabel();
         this.radioItem.setToggleState(isActive);
-        this.radioItem.setStatus(this._getStatus());
         this.emit('icon-changed');
     }
 
-    _getStatus() {
-        if (this._activeConnection == null)
-            return null;
-
-        switch (this._activeConnection.vpn_state) {
-        case NM.VpnConnectionState.DISCONNECTED:
-        case NM.VpnConnectionState.ACTIVATED:
-            return null;
-        case NM.VpnConnectionState.PREPARE:
-        case NM.VpnConnectionState.CONNECT:
-        case NM.VpnConnectionState.IP_CONFIG_GET:
-            return _("connecting…");
-        case NM.VpnConnectionState.NEED_AUTH:
-            /* Translators: this is for network connections that require some kind of key or password */
-            return _("authentication required");
-        case NM.VpnConnectionState.FAILED:
-            return _("connection failed");
-        default:
-            return 'invalid';
-        }
-    }
-
     _connectionStateChanged(ac, newstate, reason) {
         if (newstate === NM.VpnConnectionState.FAILED &&
             reason !== NM.VpnConnectionStateReason.NO_SECRETS)